<?php

define("_SessionName", "queryRecordList");
require("header.php");

if ($_POST["dateTag"] == "") {
    $sql = "SELECT * FROM `sport_motion` WHERE `master`={$_POST["master"]}";
}
else {
    $sql = "SELECT * FROM `sport_motion` WHERE `master`={$_POST["master"]} AND `dateTag`='{$_POST["dateTag"]}'";
}

// echo $sql . "\n";

$result = $conn->query($sql);

if ($result->num_rows > 0) {
    $list = $result->fetch_all(MYSQLI_ASSOC);
}
else {
    $list = [];
}

echo json_encode($list);
 
$conn->close();

?>